﻿package mortal.game.net.command.battlefield
{
    import Framework.MQ.*;
    import Message.Command.*;
    import Message.Public.*;
    import mortal.game.cache.*;
    import mortal.game.mvc.*;
    import mortal.game.net.broadCast.*;
    import mortal.mvc.core.*;

    public class BattleFieldCommand extends BroadCastCall
    {

        public function BattleFieldCommand(param1:Object)
        {
            super(param1);
            return;
        }// end function

        override public function call(param1:MessageBlock) : void
        {
            var _loc_2:SBattleFieldOpen = null;
            var _loc_3:SBattleFieldScore = null;
            var _loc_4:SMyScore = null;
            var _loc_5:SBattleFieldPlayerScores = null;
            var _loc_6:SMiniPlayer = null;
            var _loc_7:SPublicInt = null;
            switch(param1.messageHead.command)
            {
                case EPublicCommand._ECmdPublicOpenBattleField:
                {
                    _loc_2 = param1.messageBase as SBattleFieldOpen;
                    Cache.instance.battlefieldCache.battlefieldOpen = _loc_2;
                    NetDispatcher.dispatchCmd(ServerCommand.BattlefieldOpen, _loc_2);
                    break;
                }
                case EPublicCommand._ECmdPublicCloseBattleField:
                {
                    Cache.instance.battlefieldCache.close();
                    NetDispatcher.dispatchCmd(ServerCommand.BattlefieldClose, null);
                    break;
                }
                case EPublicCommand._ECmdPublicBattleFieldForceScore:
                {
                    _loc_3 = param1.messageBase as SBattleFieldScore;
                    Cache.instance.battlefieldCache.battlefieldScore = _loc_3;
                    NetDispatcher.dispatchCmd(ServerCommand.BattlefieldForceScore, _loc_3);
                    break;
                }
                case EPublicCommand._ECmdPublicBattleFieldPlayerScore:
                {
                    _loc_4 = param1.messageBase as SMyScore;
                    Cache.instance.battlefieldCache.myScore = _loc_4;
                    NetDispatcher.dispatchCmd(ServerCommand.BattlefieldPlayerScore, _loc_4);
                    break;
                }
                case EPublicCommand._ECmdPublicBattleFieldBattleBegin:
                {
                    NetDispatcher.dispatchCmd(ServerCommand.BattlefieldBattleBegin, null);
                    break;
                }
                case EPublicCommand._ECmdPublicBattleFieldResult:
                {
                    _loc_5 = param1.messageBase as SBattleFieldPlayerScores;
                    Cache.instance.battlefieldCache.battleFieldResult = _loc_5;
                    NetDispatcher.dispatchCmd(ServerCommand.BattlefieldResult, _loc_5);
                    break;
                }
                case EPublicCommand._ECmdPublicBattleFieldForceTerminated:
                {
                    NetDispatcher.dispatchCmd(ServerCommand.BattlefieldForceTerminated, null);
                    break;
                }
                case EPublicCommand._ECmdPublicBattleFieldBeKill:
                {
                    _loc_6 = param1.messageBase as SMiniPlayer;
                    NetDispatcher.dispatchCmd(ServerCommand.BattlefieldBeKill, _loc_6);
                    break;
                }
                case EPublicCommand._ECmdPublicBattleFieldContinueCut:
                {
                    _loc_7 = param1.messageBase as SPublicInt;
                    NetDispatcher.dispatchCmd(ServerCommand.BattlefieldContinueCut, _loc_7.publicInt);
                    break;
                }
                case EPublicCommand._ECmdPublicBattleFieldContinueCutTerminated:
                {
                    NetDispatcher.dispatchCmd(ServerCommand.BattlefieldContinueCutTerminated, null);
                    break;
                }
                default:
                {
                    break;
                }
            }
            return;
        }// end function

    }
}
